package com.hometeacher.api.service;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import com.hometeacher.api.model.User;
import org.springframework.stereotype.Service;

/**
 * @author ZhaoYuan
 * @data 09/04/2020 22:00
 */
@Service("TokenService")
public class TokenService {
    public String getToken(User user){
        String token = "";
        token = JWT.create().withAudience(Long.toString(user.getUid()))
                .sign(Algorithm.HMAC256(user.getPassword()));
        return token;
    }
}
